/*
ID: icerupt1
PROG: hamming
LANG: C++11
*/
#include <fstream>
#include <iostream>
#include <algorithm>
#include <vector>

std::ifstream fin {"hamming.in" };
std::ofstream fout{"hamming.out"};

int const max_bit_count = 1<<8;
int degree[max_bit_count];
bool map[max_bit_count][max_bit_count];
int n, b, d;

int bit_count_one(int x)
{
	x = (x & 0x55555555) + ((x>>1) & 0x55555555);
	x = (x & 0x33333333) + ((x>>2) & 0x33333333);
	x = (x & 0x0F0F0F0F) + ((x>>4) & 0x0F0F0F0F);
	x = (x & 0x00FF00FF) + ((x>>8) & 0x00FF00FF);
	x = (x & 0x0000FFFF) + ((x>>16)& 0x0000FFFF);
	return x;
}

bool hamming(int x, int y)
{
	return (bit_count_one(x ^ y) >= d);
}

void print(std::vector<int> const& to_print)
{
	int j = 0;
	for (auto s : to_print) {
		if (j == 0) { std::cout << s; fout << s; }
		else		{ std::cout << ' ' << s; fout << ' ' << s; }
		j = (j + 1) % 10;
		if (j == 0) { std::cout << '\n'; fout << '\n'; }
	}
	if (j != 0) { std::cout << '\n'; fout << '\n'; }
}

int find_next(std::vector<int> const& check)
{
	int x = check[check.size() - 1];
	for (int i = x + 1; i < (1<<b); i++) {
		int j = check.size() - 1;
		for (; j >= 0; j--) if (!hamming(check[j], i)) break;
		if (j < 0) return i;
	}
	return 0;
}

int main()
{
	fin >> n >> b >> d;

	for (int first = 0; first < (1<<b); first++) {
		std::vector<int> to_print;
		for (int i = 0, now = first; i < n; i++) {
			to_print.push_back(now);
			if (i < n - 1) { now = find_next(to_print); if (!now) break; }
		}
		if ((int)to_print.size() == n) { print(to_print); break; }
	}
}
